package com.tg.excel;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;

import java.io.*;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by linzc on 2018/11/27.
 */
public class SuzakuData2Excel {
    private static final String EXCEL_XLS = "xls";
    private static final String EXCEL_XLSX = "xlsx";

    private static final String data1128 = "[{\"_id\":\"5a6eedb5c270ed753531a1fa\",\"Title\":\"运动达人最福利\",\"BeginDate\":\"2018-04-19T16:00:00Z\",\"EndDate\":\"2018-12-31T16:00:00Z\",\"Missions\":[{\"_id\":\"8714e0ee-04f1-41bb-ab64-e3dea96c3f7b\",\"Mid\":123,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-04-19T16:00:00Z\",\"EndDate\":\"2018-12-31T16:00:00Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ea81ac270ed1374df77a1\",\"Title\":\"开通银行存管\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T05:48:44Z\",\"Missions\":[{\"_id\":\"a270b755-b725-474a-a1d0-a81d72f92d5e\",\"Mid\":186,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Depository.CreateAccountSuccessEvent,WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T05:48:44Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eaa6cc270ed1374df77a3\",\"Title\":\"完成首次出借\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T05:55:50Z\",\"Missions\":[{\"_id\":\"f638c63b-4723-4292-ac49-be50d4c114f1\",\"Mid\":187,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T05:55:50Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eba17c270ed1374df77a8\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-27T07:07:30Z\",\"Missions\":[{\"_id\":\"a29999f2-be27-45a5-a116-b3f50d01ee1f\",\"Mid\":189,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-27T07:07:30Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b6940bcc270ed1142fe6e83\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-08-30T06:44:44Z\",\"Missions\":[{\"_id\":\"241674fb-a608-4f54-ad77-b82490faec30\",\"Mid\":229,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-08-30T06:44:44Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9854bc270ed761af9ce40\",\"Title\":\"合伙人基础20181101版话费奖励\",\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-12-31T15:59:59Z\",\"Missions\":[{\"_id\":\"1c874103-6c75-4ea8-8010-b6dac8e3a63a\",\"Mid\":320,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-12-31T15:59:59Z\",\"CycleType\":3,\"CountInCycle\":5,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b237341c270ed074ddd6d76\",\"Title\":\"完成风险测评\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-06-14T08:02:32Z\",\"Missions\":[{\"_id\":\"d23f8e85-48bc-4612-8dee-c3b6d5ab9668\",\"Mid\":155,\"ScheduleRule\":{\"EventNameOrCron\":\"com.whtr.appbe.risktest.web.vo.RiskResultEvent\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-06-14T08:02:32Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ea682c270ed1374df779f\",\"Title\":\"完成注册\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-18T05:40:18Z\",\"Missions\":[{\"_id\":\"850eed66-7b70-4c73-88a6-3f02c0a399c3\",\"Mid\":185,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-18T05:40:18Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd958fcc270ed761af9ce3b\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:23:49Z\",\"EndDate\":\"2023-10-31T07:23:54Z\",\"Missions\":[{\"_id\":\"7dc573f3-843c-45f9-87e0-69be6ff15003\",\"Mid\":317,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:23:49Z\",\"EndDate\":\"2023-10-31T07:23:54Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9876ec270ed761af9ce41\",\"Title\":\"合伙人20181101投资返现\",\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-12-31T15:59:59Z\",\"Missions\":[{\"_id\":\"dfbe9a3d-8c3f-4338-94a9-83f5195fca2b\",\"Mid\":321,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-11-30T15:59:59Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5bd98a2ec270ed761af9ce42\",\"Title\":\"新版合伙人20181101被邀请人奖励\",\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-12-31T15:59:59Z\",\"Missions\":[{\"_id\":\"b445b217-08f5-4c45-92b0-b8c942a932a8\",\"Mid\":322,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00Z\",\"EndDate\":\"2019-12-31T15:59:59Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5bdaa9b5c270ed761af9ce65\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-10-30T07:14:32Z\",\"EndDate\":\"2022-11-29T07:14:38Z\",\"Missions\":[{\"_id\":\"e6e2e4e0-ee75-4ee5-b831-dba43a1c7996\",\"Mid\":323,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-30T07:14:32Z\",\"EndDate\":\"2022-11-29T07:14:38Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bdac5a6c270ed761af9ce66\",\"Title\":\"50积分抽奖\",\"BeginDate\":\"2018-10-31T16:00:00Z\",\"EndDate\":\"2019-12-31T16:00:00Z\",\"Missions\":[{\"_id\":\"ee685318-2505-4d14-9e4e-35607ddabaee\",\"Mid\":324,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-31T16:00:00Z\",\"EndDate\":\"2019-12-31T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"\"}]},{\"_id\":\"5bdbf4a6c270ed761af9ce6a\",\"Title\":\"天天转赚乐\",\"BeginDate\":\"2018-11-05T02:00:00Z\",\"EndDate\":\"2018-11-28T15:59:59Z\",\"Missions\":[{\"_id\":\"9a98b00d-0206-4eca-a43c-352bc6098253\",\"Mid\":325,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.LoginEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-05T02:00:00Z\",\"EndDate\":\"2018-11-28T15:59:59Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bdc16c8c270ed761af9ce7b\",\"Title\":\"ofo加息券奖励\",\"BeginDate\":\"2018-11-05T16:00:00Z\",\"EndDate\":\"2018-12-10T15:59:59Z\",\"Missions\":[{\"_id\":\"18bb9bd8-2ea9-4a5e-a3b1-3c62560fce73\",\"Mid\":329,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-05T16:00:00Z\",\"EndDate\":\"2018-12-10T15:59:59Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5be91f9ac270ed761af9ceaf\",\"Title\":\"续期返现本息计息\",\"BeginDate\":\"2018-11-10T16:00:00Z\",\"EndDate\":\"2020-12-30T16:00:00Z\",\"Missions\":[{\"_id\":\"62871ebb-b11b-4954-8ab0-f038e2c09deb\",\"Mid\":332,\"ScheduleRule\":{\"EventNameOrCron\":\"trade.invest.renewal.fanout.exchange\"},\"BeginDate\":\"2018-11-10T16:00:00Z\",\"EndDate\":\"2020-12-30T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"\"}]},{\"_id\":\"5beced84c270ed26e04e47c3\",\"Title\":\"ofo1元现金+99元券\",\"BeginDate\":\"2018-11-13T16:00:00Z\",\"EndDate\":\"2018-12-09T16:00:00Z\",\"Missions\":[{\"_id\":\"e08a3a1a-ccd0-4b3e-9f77-d8c8009f6786\",\"Mid\":333,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.ThirdPartyInvestPresentEvent,WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-13T16:00:00Z\",\"EndDate\":\"2018-12-09T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5becef34c270ed26e04e47c4\",\"Title\":\"ofo年卡/月卡\",\"BeginDate\":\"2018-11-14T16:00:00Z\",\"EndDate\":\"2018-12-06T16:00:00Z\",\"Missions\":[{\"_id\":\"5379e673-e7fb-4311-b351-944e91030dca\",\"Mid\":334,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-13T16:00:00Z\",\"EndDate\":\"2018-12-09T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"},{\"_id\":\"30ef8683-7ee5-435d-8c2b-35fbda35d0e4\",\"Mid\":335,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-13T16:00:00Z\",\"EndDate\":\"2018-12-09T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bf263aac270ed26e04e47d4\",\"Title\":\"群咖学院\",\"BeginDate\":\"2018-11-18T16:00:00Z\",\"EndDate\":\"2018-12-11T16:00:00Z\",\"Missions\":[{\"_id\":\"4260dce4-0099-463b-9b6d-26904fdac4ae\",\"Mid\":337,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-18T16:00:00Z\",\"EndDate\":\"2018-12-11T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b59376ec270ed1374df777a\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T09:26:18Z\",\"Missions\":[{\"_id\":\"9f482e2d-9dd7-4cd5-b72b-1763ee0022cf\",\"Mid\":176,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-26T09:26:18Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ee1a4c270ed1374df77ca\",\"Title\":\"邀好友累计出借1万\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-16T04:41:14Z\",\"Missions\":[{\"_id\":\"612b2911-5f3c-45d2-b5cb-a44b82f735b7\",\"Mid\":207,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-16T04:41:14Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee2c1c270ed1374df77cc\",\"Title\":\"邀好友累计出借5万\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-31T10:02:04Z\",\"Missions\":[{\"_id\":\"71b26382-d3aa-4717-962a-32b41def92a7\",\"Mid\":208,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-31T10:02:04Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee3dec270ed1374df77ce\",\"Title\":\"邀友累计出借10万\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-18T16:00:00Z\",\"Missions\":[{\"_id\":\"42d39c0f-b838-4fed-960f-3c241f23a1c8\",\"Mid\":209,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-18T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee61cc270ed1374df77d0\",\"Title\":\"邀友累计出借20万\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-18T16:00:00Z\",\"Missions\":[{\"_id\":\"f77d77b3-1e2a-4613-b31c-ddca693a24f9\",\"Mid\":210,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-11-18T16:00:00Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5eb8e5c270ed1374df77a6\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-10T06:46:09Z\",\"Missions\":[{\"_id\":\"2abd368b-b8e2-42d4-88d3-bd101d2cc467\",\"Mid\":188,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00Z\",\"EndDate\":\"2019-07-10T06:46:09Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd80d2ac270ed1f96049009\",\"Title\":\"新手活动-3000元礼包-1030\",\"BeginDate\":\"2018-10-30T10:00:00Z\",\"EndDate\":\"2019-11-29T16:00:00Z\",\"Missions\":[{\"_id\":\"55744826-e70b-4f4c-9de6-8d8e346e23d0\",\"Mid\":299,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-30T10:00:00Z\",\"EndDate\":\"2019-10-30T16:00:00Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9562ac270ed761af9ce39\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-10-30T07:10:11Z\",\"EndDate\":\"2022-10-31T07:10:13Z\",\"Missions\":[{\"_id\":\"4a33ce6c-9fef-470b-8b9a-74766f753b1d\",\"Mid\":316,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:10:11Z\",\"EndDate\":\"2022-10-31T07:10:13Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd95f02c270ed761af9ce3f\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:50:04Z\",\"EndDate\":\"2022-10-31T07:50:06Z\",\"Missions\":[{\"_id\":\"daf89ea6-4969-4666-8903-a5b79146adf1\",\"Mid\":319,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:50:04Z\",\"EndDate\":\"2022-10-31T07:50:06Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]}]";

    private static final String data1207 = "[{\"_id\":\"5a6eedb5c270ed753531a1fa\",\"Title\":\"运动达人最福利\",\"BeginDate\":\"2018-04-19T16:00:00.000Z\",\"EndDate\":\"2018-12-31T16:00:00.000Z\",\"Missions\":[{\"_id\":\"8714e0ee-04f1-41bb-ab64-e3dea96c3f7b\",\"Mid\":123,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-04-19T16:00:00.000Z\",\"EndDate\":\"2018-12-31T16:00:00.000Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ea81ac270ed1374df77a1\",\"Title\":\"开通银行存管\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:48:44.000Z\",\"Missions\":[{\"_id\":\"a270b755-b725-474a-a1d0-a81d72f92d5e\",\"Mid\":186,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Depository.CreateAccountSuccessEvent,WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:48:44.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eaa6cc270ed1374df77a3\",\"Title\":\"完成首次出借\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:55:50.000Z\",\"Missions\":[{\"_id\":\"f638c63b-4723-4292-ac49-be50d4c114f1\",\"Mid\":187,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:55:50.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eba17c270ed1374df77a8\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-27T07:07:30.000Z\",\"Missions\":[{\"_id\":\"a29999f2-be27-45a5-a116-b3f50d01ee1f\",\"Mid\":189,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-27T07:07:30.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b6940bcc270ed1142fe6e83\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-08-30T06:44:44.000Z\",\"Missions\":[{\"_id\":\"241674fb-a608-4f54-ad77-b82490faec30\",\"Mid\":229,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-08-30T06:44:44.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9854bc270ed761af9ce40\",\"Title\":\"合伙人基础20181101版话费奖励\",\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"1c874103-6c75-4ea8-8010-b6dac8e3a63a\",\"Mid\":320,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"CycleType\":3,\"CountInCycle\":5,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b237341c270ed074ddd6d76\",\"Title\":\"完成风险测评\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-06-14T08:02:32.000Z\",\"Missions\":[{\"_id\":\"d23f8e85-48bc-4612-8dee-c3b6d5ab9668\",\"Mid\":155,\"ScheduleRule\":{\"EventNameOrCron\":\"com.whtr.appbe.risktest.web.vo.RiskResultEvent\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-06-14T08:02:32.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd958fcc270ed761af9ce3b\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:23:49.000Z\",\"EndDate\":\"2023-10-31T07:23:54.000Z\",\"Missions\":[{\"_id\":\"7dc573f3-843c-45f9-87e0-69be6ff15003\",\"Mid\":317,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:23:49.000Z\",\"EndDate\":\"2023-10-31T07:23:54.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9876ec270ed761af9ce41\",\"Title\":\"合伙人20181101投资返现\",\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"dfbe9a3d-8c3f-4338-94a9-83f5195fca2b\",\"Mid\":321,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-11-30T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5bdaa9b5c270ed761af9ce65\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-10-30T07:14:32.000Z\",\"EndDate\":\"2022-11-29T07:14:38.000Z\",\"Missions\":[{\"_id\":\"e6e2e4e0-ee75-4ee5-b831-dba43a1c7996\",\"Mid\":323,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-30T07:14:32.000Z\",\"EndDate\":\"2022-11-29T07:14:38.000Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bdc16c8c270ed761af9ce7b\",\"Title\":\"ofo加息券奖励\",\"BeginDate\":\"2018-11-05T16:00:00.000Z\",\"EndDate\":\"2018-12-10T15:59:59.000Z\",\"Missions\":[{\"_id\":\"18bb9bd8-2ea9-4a5e-a3b1-3c62560fce73\",\"Mid\":329,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-05T16:00:00.000Z\",\"EndDate\":\"2018-12-10T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5be91f9ac270ed761af9ceaf\",\"Title\":\"续期返现本息计息\",\"BeginDate\":\"2018-11-10T16:00:00.000Z\",\"EndDate\":\"2020-12-30T16:00:00.000Z\",\"Missions\":[{\"_id\":\"62871ebb-b11b-4954-8ab0-f038e2c09deb\",\"Mid\":332,\"ScheduleRule\":{\"EventNameOrCron\":\"trade.invest.renewal.fanout.exchange\"},\"BeginDate\":\"2018-11-10T16:00:00.000Z\",\"EndDate\":\"2020-12-30T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"\"}]},{\"_id\":\"5beced84c270ed26e04e47c3\",\"Title\":\"ofo1元现金+99元券\",\"BeginDate\":\"2018-11-13T16:00:00.000Z\",\"EndDate\":\"2018-12-09T16:00:00.000Z\",\"Missions\":[{\"_id\":\"e08a3a1a-ccd0-4b3e-9f77-d8c8009f6786\",\"Mid\":333,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.ThirdPartyInvestPresentEvent,WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-13T16:00:00.000Z\",\"EndDate\":\"2018-12-09T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bf263aac270ed26e04e47d4\",\"Title\":\"群咖学院\",\"BeginDate\":\"2018-11-18T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"4260dce4-0099-463b-9b6d-26904fdac4ae\",\"Mid\":337,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-18T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bfbc007c270ed1c515d2d35\",\"Title\":\"翻牌赢好礼\",\"BeginDate\":\"2018-12-05T16:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"Missions\":[{\"_id\":\"1e0af305-259b-4ccc-9bfc-af031365fcb9\",\"Mid\":340,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.LoginEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-05T16:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bffb73ec270ed1c515d2d58\",\"Title\":\"OPPO会员区\",\"BeginDate\":\"2018-11-29T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"49024107-187f-4b1b-ae93-606fcedcc3db\",\"Mid\":343,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-29T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5c090071c270ed7df950330c\",\"Title\":\"菜鸟理财2%补贴券\",\"BeginDate\":\"2018-12-06T16:00:00.000Z\",\"EndDate\":\"2019-01-11T15:59:59.000Z\",\"Missions\":[{\"_id\":\"46209073-9232-4aa3-a693-1b10b4cabd23\",\"Mid\":345,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-06T16:00:00.000Z\",\"EndDate\":\"2019-01-11T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b59376ec270ed1374df777a\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T09:26:18.000Z\",\"Missions\":[{\"_id\":\"9f482e2d-9dd7-4cd5-b72b-1763ee0022cf\",\"Mid\":176,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T09:26:18.000Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ee1a4c270ed1374df77ca\",\"Title\":\"邀好友累计出借1万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-16T04:41:14.000Z\",\"Missions\":[{\"_id\":\"612b2911-5f3c-45d2-b5cb-a44b82f735b7\",\"Mid\":207,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-16T04:41:14.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee2c1c270ed1374df77cc\",\"Title\":\"邀好友累计出借5万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-31T10:02:04.000Z\",\"Missions\":[{\"_id\":\"71b26382-d3aa-4717-962a-32b41def92a7\",\"Mid\":208,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-31T10:02:04.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee3dec270ed1374df77ce\",\"Title\":\"邀友累计出借10万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"Missions\":[{\"_id\":\"42d39c0f-b838-4fed-960f-3c241f23a1c8\",\"Mid\":209,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee61cc270ed1374df77d0\",\"Title\":\"邀友累计出借20万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"Missions\":[{\"_id\":\"f77d77b3-1e2a-4613-b31c-ddca693a24f9\",\"Mid\":210,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5eb8e5c270ed1374df77a6\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-10T06:46:09.000Z\",\"Missions\":[{\"_id\":\"2abd368b-b8e2-42d4-88d3-bd101d2cc467\",\"Mid\":188,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-10T06:46:09.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9562ac270ed761af9ce39\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-10-30T07:10:11.000Z\",\"EndDate\":\"2022-10-31T07:10:13.000Z\",\"Missions\":[{\"_id\":\"4a33ce6c-9fef-470b-8b9a-74766f753b1d\",\"Mid\":316,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:10:11.000Z\",\"EndDate\":\"2022-10-31T07:10:13.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd95f02c270ed761af9ce3f\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:50:04.000Z\",\"EndDate\":\"2022-10-31T07:50:06.000Z\",\"Missions\":[{\"_id\":\"daf89ea6-4969-4666-8903-a5b79146adf1\",\"Mid\":319,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:50:04.000Z\",\"EndDate\":\"2022-10-31T07:50:06.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]}]";

    private static final String data1217="[{\"_id\":\"5a6eedb5c270ed753531a1fa\",\"Title\":\"运动达人最福利\",\"BeginDate\":\"2018-04-19T16:00:00.000Z\",\"EndDate\":\"2018-12-31T16:00:00.000Z\",\"Missions\":[{\"_id\":\"8714e0ee-04f1-41bb-ab64-e3dea96c3f7b\",\"Mid\":123,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-04-19T16:00:00.000Z\",\"EndDate\":\"2018-12-31T16:00:00.000Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ea81ac270ed1374df77a1\",\"Title\":\"开通银行存管\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:48:44.000Z\",\"Missions\":[{\"_id\":\"a270b755-b725-474a-a1d0-a81d72f92d5e\",\"Mid\":186,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Depository.CreateAccountSuccessEvent,WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:48:44.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eaa6cc270ed1374df77a3\",\"Title\":\"完成首次出借\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:55:50.000Z\",\"Missions\":[{\"_id\":\"f638c63b-4723-4292-ac49-be50d4c114f1\",\"Mid\":187,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T05:55:50.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5eba17c270ed1374df77a8\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-27T07:07:30.000Z\",\"Missions\":[{\"_id\":\"a29999f2-be27-45a5-a116-b3f50d01ee1f\",\"Mid\":189,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-27T07:07:30.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b6940bcc270ed1142fe6e83\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-08-30T06:44:44.000Z\",\"Missions\":[{\"_id\":\"241674fb-a608-4f54-ad77-b82490faec30\",\"Mid\":229,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-08-30T06:44:44.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9854bc270ed761af9ce40\",\"Title\":\"合伙人基础20181101版话费奖励\",\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"1c874103-6c75-4ea8-8010-b6dac8e3a63a\",\"Mid\":320,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"CycleType\":3,\"CountInCycle\":5,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b237341c270ed074ddd6d76\",\"Title\":\"完成风险测评\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-06-14T08:02:32.000Z\",\"Missions\":[{\"_id\":\"d23f8e85-48bc-4612-8dee-c3b6d5ab9668\",\"Mid\":155,\"ScheduleRule\":{\"EventNameOrCron\":\"com.whtr.appbe.risktest.web.vo.RiskResultEvent\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-06-14T08:02:32.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd958fcc270ed761af9ce3b\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:23:49.000Z\",\"EndDate\":\"2023-10-31T07:23:54.000Z\",\"Missions\":[{\"_id\":\"7dc573f3-843c-45f9-87e0-69be6ff15003\",\"Mid\":317,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:23:49.000Z\",\"EndDate\":\"2023-10-31T07:23:54.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9876ec270ed761af9ce41\",\"Title\":\"合伙人20181101投资返现\",\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"dfbe9a3d-8c3f-4338-94a9-83f5195fca2b\",\"Mid\":321,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-02T02:00:00.000Z\",\"EndDate\":\"2019-11-30T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5bdaa9b5c270ed761af9ce65\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-10-30T07:14:32.000Z\",\"EndDate\":\"2022-11-29T07:14:38.000Z\",\"Missions\":[{\"_id\":\"e6e2e4e0-ee75-4ee5-b831-dba43a1c7996\",\"Mid\":323,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-30T07:14:32.000Z\",\"EndDate\":\"2022-11-29T07:14:38.000Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bdac5a6c270ed761af9ce66\",\"Title\":\"50积分抽奖\",\"BeginDate\":\"2018-10-31T16:00:00.000Z\",\"EndDate\":\"2019-12-31T16:00:00.000Z\",\"Missions\":[{\"_id\":\"ee685318-2505-4d14-9e4e-35607ddabaee\",\"Mid\":324,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-10-31T16:00:00.000Z\",\"EndDate\":\"2019-12-31T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"\"}]},{\"_id\":\"5be91f9ac270ed761af9ceaf\",\"Title\":\"续期返现本息计息\",\"BeginDate\":\"2018-11-10T16:00:00.000Z\",\"EndDate\":\"2020-12-30T16:00:00.000Z\",\"Missions\":[{\"_id\":\"62871ebb-b11b-4954-8ab0-f038e2c09deb\",\"Mid\":332,\"ScheduleRule\":{\"EventNameOrCron\":\"trade.invest.renewal.fanout.exchange\"},\"BeginDate\":\"2018-11-10T16:00:00.000Z\",\"EndDate\":\"2020-12-30T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":0,\"Target\":\"\"}]},{\"_id\":\"5bf263aac270ed26e04e47d4\",\"Title\":\"群咖学院\",\"BeginDate\":\"2018-11-18T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"4260dce4-0099-463b-9b6d-26904fdac4ae\",\"Mid\":337,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-18T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bfbc007c270ed1c515d2d35\",\"Title\":\"翻牌赢好礼\",\"BeginDate\":\"2018-12-05T16:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"Missions\":[{\"_id\":\"1e0af305-259b-4ccc-9bfc-af031365fcb9\",\"Mid\":340,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.LoginEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-05T16:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bffb73ec270ed1c515d2d58\",\"Title\":\"OPPO会员区\",\"BeginDate\":\"2018-11-29T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"Missions\":[{\"_id\":\"49024107-187f-4b1b-ae93-606fcedcc3db\",\"Mid\":343,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-11-29T16:00:00.000Z\",\"EndDate\":\"2018-12-31T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5c090071c270ed7df950330c\",\"Title\":\"菜鸟理财2%补贴券\",\"BeginDate\":\"2018-12-06T16:00:00.000Z\",\"EndDate\":\"2019-01-11T15:59:59.000Z\",\"Missions\":[{\"_id\":\"46209073-9232-4aa3-a693-1b10b4cabd23\",\"Mid\":345,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-06T16:00:00.000Z\",\"EndDate\":\"2019-01-11T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5c0e1c64c270ed7df9503327\",\"Title\":\"双12注册送体验金\",\"BeginDate\":\"2018-12-12T02:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"Missions\":[{\"_id\":\"1fa75e41-e276-4fb2-a673-40b6eb6d7b70\",\"Mid\":349,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Customer.RegistrationEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-12T02:00:00.000Z\",\"EndDate\":\"2018-12-28T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b59376ec270ed1374df777a\",\"Title\":\"每周参与0元购\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T09:26:18.000Z\",\"Missions\":[{\"_id\":\"9f482e2d-9dd7-4cd5-b72b-1763ee0022cf\",\"Mid\":176,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-26T09:26:18.000Z\",\"CycleType\":2,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5b5ee1a4c270ed1374df77ca\",\"Title\":\"邀好友累计出借1万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-16T04:41:14.000Z\",\"Missions\":[{\"_id\":\"612b2911-5f3c-45d2-b5cb-a44b82f735b7\",\"Mid\":207,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-16T04:41:14.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee2c1c270ed1374df77cc\",\"Title\":\"邀好友累计出借5万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-31T10:02:04.000Z\",\"Missions\":[{\"_id\":\"71b26382-d3aa-4717-962a-32b41def92a7\",\"Mid\":208,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-31T10:02:04.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee3dec270ed1374df77ce\",\"Title\":\"邀友累计出借10万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"Missions\":[{\"_id\":\"42d39c0f-b838-4fed-960f-3c241f23a1c8\",\"Mid\":209,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5ee61cc270ed1374df77d0\",\"Title\":\"邀友累计出借20万\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"Missions\":[{\"_id\":\"f77d77b3-1e2a-4613-b31c-ddca693a24f9\",\"Mid\":210,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-11-18T16:00:00.000Z\",\"CycleType\":3,\"CountInCycle\":1,\"Target\":\"InvitationInfo.InvitationCustomerId\"}]},{\"_id\":\"5b5eb8e5c270ed1374df77a6\",\"Title\":\"分享公司资讯\",\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-10T06:46:09.000Z\",\"Missions\":[{\"_id\":\"2abd368b-b8e2-42d4-88d3-bd101d2cc467\",\"Mid\":188,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-07-31T06:00:00.000Z\",\"EndDate\":\"2019-07-10T06:46:09.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd9562ac270ed761af9ce39\",\"Title\":\"分享P友圈文章\",\"BeginDate\":\"2018-10-30T07:10:11.000Z\",\"EndDate\":\"2022-10-31T07:10:13.000Z\",\"Missions\":[{\"_id\":\"4a33ce6c-9fef-470b-8b9a-74766f753b1d\",\"Mid\":316,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.ShareSuccessEvent,WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:10:11.000Z\",\"EndDate\":\"2022-10-31T07:10:13.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5bd95f02c270ed761af9ce3f\",\"Title\":\"每日签到\",\"BeginDate\":\"2018-10-30T07:50:04.000Z\",\"EndDate\":\"2022-10-31T07:50:06.000Z\",\"Missions\":[{\"_id\":\"daf89ea6-4969-4666-8903-a5b79146adf1\",\"Mid\":319,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.Mission.Contracts.Events.AppSignInEvent, WHTR.Mission.Contracts\"},\"BeginDate\":\"2018-10-30T07:50:04.000Z\",\"EndDate\":\"2022-10-31T07:50:06.000Z\",\"CycleType\":1,\"CountInCycle\":1,\"Target\":\"\"}]},{\"_id\":\"5c0a21b9c270ed7df9503313\",\"Title\":\"1212新手礼包\",\"BeginDate\":\"2018-12-10T02:00:00.000Z\",\"EndDate\":\"2018-12-28T15:59:59.000Z\",\"Missions\":[{\"_id\":\"a423f265-f7f1-4347-9606-3b8b2a39504e\",\"Mid\":347,\"ScheduleRule\":{\"EventNameOrCron\":\"WHTR.SOA.Contracts.Events.Investment.NginfInvestEvent, WHTR.SOA.Contracts\"},\"BeginDate\":\"2018-12-10T02:00:00.000Z\",\"EndDate\":\"2018-12-28T15:59:59.000Z\",\"CycleType\":0,\"CountInCycle\":1,\"Target\":\"\"}]}]";

//    private static "完成风险测评"
//            ,"续期返现本息计息"
//            ,"每日签到"
//            ,"每日签到"
//            ,"分享公司资讯"
//            ,"分享公司资讯"
//            ,"分享P友圈文章"
//            ,"分享P友圈文章"
//            ,"天天转赚乐"
//            ,"运动达人最福利"
//            ,"完成注册
//            ,"新版合伙人20181101被邀请人奖励"
//            ,"开通银行存管"
//            ,"ofo年卡/月卡"
//            ,"ofo年卡/月卡"
//            ,"ofo加息券奖励"
//            ,"群咖学院"
//            ,"完成首次出借"
//            ,"每周参与0元购"
//            ,"邀好友累计出借5万"
//            ,"新手活动-3000元礼包-1030"
//            ,"邀好友累计出借1万"
//            ,"邀友累计出借10万"
//            ,"邀友累计出借20万"
//            ,"合伙人20181101投资返现"
//            ,"合伙人基础20181101版话费奖励"
//            ,"50积分抽奖"
//            ,"每周参与0元购"
//            ,"ofo1元现金+99元券"


    private List<String> columns = Lists.newArrayList("活动Id" , "活动标题" , "结束时间" , "任务Id" , "任务短码" , "事件" , "任务结束时间" , "周期类型" , "次数");

    @Test
    public void test() throws Exception {
        ObjectMapper objectMapper = new ObjectMapper();
        List<Activity> value1128 = objectMapper.readValue(data1128, new TypeReference<List<Activity>>() {
        });

        List<Activity> value1207 = objectMapper.readValue(data1207, new TypeReference<List<Activity>>() {
        });

        List<Activity> value1217 = objectMapper.readValue(data1217, new TypeReference<List<Activity>>() {
        });

        writeExcelEvent(value1207, "D:\\suzaku1207All.xls");

        List<Activity> list = value1207.stream().filter(nw -> {
            return !value1128.stream().anyMatch(old -> old.getTitle().equals(nw.getTitle()));
        }).collect(Collectors.toList());


        writeExcelEvent(list, "D:\\suzaku1207.xls");

        List<Activity> list2 = value1217.stream().filter(nw -> {
            return !value1128.stream().anyMatch(old -> old.getTitle().equals(nw.getTitle()));
        }).collect(Collectors.toList());

        writeExcelEvent(list2, "D:\\suzaku1217.xls");
    }

    public void writeExcelEvent(List<Activity> activities, String finalXlsxPath) throws Exception {
        if (activities == null || activities.isEmpty()) {
            throw new IllegalArgumentException("没有输出结果");
        }

        List<Mission> missions = activities.stream()
                .filter(activity -> activity.getMissions() != null)
                .map(activity -> {
                    List<Mission> targets = activity.getMissions();
                    targets.stream().forEach(mission -> {
                        mission.setActBeginDate(activity.getBeginDate());
                        mission.setActEndDate(activity.getEndDate());
                        mission.setActId(activity.getId());
                        mission.setActTitle(activity.getTitle());
                    });
                    return targets;
                })
                .flatMap(List<Mission>::stream)
                .collect(Collectors.toList());

        OutputStream out = null;
        try {
            File finalXlsxFile = new File(finalXlsxPath);
            Workbook workBook = getWorkbok(finalXlsxFile);
            //默认使用第1页sheet
            Sheet sheet = workBook.getSheetAt(0);
            //删除原有数据，除了属性列
            int rowNumber = sheet.getLastRowNum();
            for (int i = 1; i <= rowNumber; i++) {
                Row row = sheet.getRow(i);
                sheet.removeRow(row);
            }
            // 创建文件输出流，输出电子表格：这个必须有，否则你在sheet上做的任何操作都不会有效
            out = new FileOutputStream(finalXlsxPath);
            workBook.write(out);

            //第一行写入字段名
            Row firstRow = sheet.createRow(0);
            int col = 0;
            for (String column : columns) {
                Cell first = firstRow.createCell(col);
                first.setCellValue(column);
                col++;
            }

            for (int rowIndex = 0; rowIndex < missions.size(); rowIndex++) {
                // 创建一行：从第二行开始，跳过属性列
                Row row = sheet.createRow(rowIndex + 1);
                // 得到要插入的每一条记录
                Mission mission = missions.get(rowIndex);

                Cell c1 = row.createCell(0);
                c1.setCellValue(mission.getActId());

                Cell c2 = row.createCell(1);
                c2.setCellValue(mission.getActTitle());

                Cell c3 = row.createCell(2);
                c3.setCellValue(mission.getActEndDate());

                Cell c4 = row.createCell(3);
                c4.setCellValue(mission.getId());
                Cell c5 = row.createCell(4);
                c5.setCellValue(mission.getMid());
                Cell c6 = row.createCell(5);
                c6.setCellValue(mission.getScheduleRule().getEventNameOrCron());
                Cell c7 = row.createCell(6);
                c7.setCellValue(mission.getEndDate());
                Cell c8 = row.createCell(7);
                c8.setCellValue(mission.getCycleType());
                Cell c9 = row.createCell(8);
                c9.setCellValue(mission.getCountInCycle());
            }
            // 创建文件输出流，准备输出电子表格：这个必须有，否则你在sheet上做的任何操作都不会有效
            out = new FileOutputStream(finalXlsxPath);
            workBook.write(out);
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                if (out != null) {
                    out.flush();
                    out.close();
                }
            } catch (IOException e) {
                /**/
            }
        }
    }

    /**
     * 判断Excel的版本,获取Workbook
     *
     * @param in
     * @param filename
     * @return
     * @throws IOException
     */
    public static Workbook getWorkbok(File file) throws IOException {
        Workbook wb = null;
        FileInputStream inputStream = null;
        try {
            inputStream = new FileInputStream(file);
            if (file.getName().endsWith(EXCEL_XLS)) {     //Excel&nbsp;2003
                wb = new HSSFWorkbook(inputStream);
            } else if (file.getName().endsWith(EXCEL_XLSX)) {    // Excel 2007/2010
                wb = new XSSFWorkbook(inputStream);
            }
            return wb;
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }
    }
}
